package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

//操作ThreadLocal的
public class UserHolder {

    //准备好存放User的ThreadLocal
    private static ThreadLocal<User> th = new ThreadLocal<User>();

    //向th存放user
    public static void setUser(User user) {
        th.set(user);
    }

    //从th获取user
    public static User getUser() {
        return th.get();
    }

    //从th移除user
    public static void removeUser() {
        th.remove();
    }
}